package com.atguigu.gmall.cart.client;

import com.atguigu.gmall.cart.fallback.CartFeignClientFallBack;
import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.cart.CartInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description:
 * @author: JC
 * @date: 2021/11/8 18:28
 */
@Component
@FeignClient(value = "service-cart",fallback = CartFeignClientFallBack.class)
public interface CartFeignClient {

    @PostMapping("api/cart/addToCart/{skuId}/{skuNum}")
    Result addToCart(@PathVariable("skuId") Long skuId,
                            @PathVariable("skuNum") Integer skuNum);

    @GetMapping("api/cart/getCartCheckedList/{userId}")
    List<CartInfo> getCartCheckedList(@PathVariable(value = "userId") String userId);


    void loadCartCache(String userId);
}
